using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Notify2
{
    sealed class SetupUtils
    {
        public static void Copy(string source, string destination)
        {
            if (File.Exists(destination))
            {
                File.SetAttributes(destination, FileAttributes.Normal);
            }
            File.Copy(source, destination, true);
            File.SetAttributes(destination, FileAttributes.Normal);
        }

        public static void DeleteFile(string filepath)
        {
            if (File.Exists(filepath))
            {
                File.SetAttributes(filepath, FileAttributes.Normal);
                File.Delete(filepath);
            }
        }

        public static void DeleteDirectory(string path)
        {
            if  (Directory.Exists(path))
            {
                string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
                foreach (string file in files)
                {
                    File.SetAttributes(file, FileAttributes.Normal);
                }
                Directory.Delete(path, true);
            }
        }
    }
}
